package com.jx.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jx.dao.FindFuncsDao;
import com.jx.daoimpl.FindFuncsDaoImpl;
import com.jx.model.Func;
import com.jx.service.UpdateFuncService;
import com.jx.servicrimpl.UpdateFuncServiceImpl;
/**
 * 更新功能
 * @author zzzzzzz
 *
 */
public class UpdateFuncController extends HttpServlet{
	UpdateFuncService ufs=new UpdateFuncServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		resp.setCharacterEncoding("utf8");
		req.setCharacterEncoding("utf8");
		// 从前台获取数据
		int fid = Integer.parseInt(req.getParameter("fid"));
		String fname = req.getParameter("fname");
		String fdes = req.getParameter("fdes");
		int fparentid = Integer.parseInt(req.getParameter("fparentid"));
		String fstate = req.getParameter("fstate");
		String fpath = req.getParameter("fpath");
		//实例化功能
		Func func = new Func(fid, fname, fdes, fparentid, fstate, fpath);
		//更新功能
		boolean result = ufs.updateFuncService(func);
		//传回数据
		PrintWriter pw = resp.getWriter();
		pw.write(String.valueOf(result));
	}
}
